Filter Design
   HOME

TheInfoList



OR:

Filter design is the process of designing a
signal processing filter In signal processing, a filter is a device or process that removes some unwanted components or features from a signal. Filtering is a class of signal processing, the defining feature of filters being the complete or partial suppression of some aspe ...
that satisfies a set of requirements, some of which may be conflicting. The purpose is to find a realization of the filter that meets each of the requirements to a sufficient degree to make it useful. The filter design process can be described as an optimization problem where each requirement contributes to an error function that should be minimized. Certain parts of the design process can be automated, but normally an experienced
electrical engineer Electrical engineering is an engineering discipline concerned with the study, design, and application of equipment, devices, and systems which use electricity, electronics, and electromagnetism. It emerged as an identifiable occupation in the l ...
is needed to get a good result. The design of digital filters is a deceptively complex topic. Although filters are easily understood and calculated, the practical challenges of their design and implementation are significant and are the subject of advanced research.


Typical design requirements

Typical requirements which are considered in the design process are: * The filter should have a specific
frequency response In signal processing and electronics, the frequency response of a system is the quantitative measure of the magnitude and phase of the output as a function of input frequency. The frequency response is widely used in the design and analysis of s ...
* The filter should have a specific
phase shift In physics and mathematics, the phase of a periodic function F of some real variable t (such as time) is an angle-like quantity representing the fraction of the cycle covered up to t. It is denoted \phi(t) and expressed in such a scale that it ...
or
group delay In signal processing, group delay and phase delay are delay times experienced by a signal's various frequency components when the signal passes through a system that is linear time-invariant (LTI), such as a microphone, coaxial cable, amplifier, ...
* The filter should have a specific
impulse response In signal processing and control theory, the impulse response, or impulse response function (IRF), of a dynamic system is its output when presented with a brief input signal, called an impulse (). More generally, an impulse response is the reac ...
* The filter should be
causal Causality (also referred to as causation, or cause and effect) is influence by which one event, process, state, or object (''a'' ''cause'') contributes to the production of another event, process, state, or object (an ''effect'') where the ca ...
* The filter should be
stable A stable is a building in which livestock, especially horses, are kept. It most commonly means a building that is divided into separate stalls for individual animals and livestock. There are many different types of stables in use today; the ...
* The filter should be localized (pulse or step inputs should result in finite time outputs) * The computational complexity of the filter should be low * The filter should be implemented in particular hardware or software


The frequency function

An important
parameter A parameter (), generally, is any characteristic that can help in defining or classifying a particular system (meaning an event, project, object, situation, etc.). That is, a parameter is an element of a system that is useful, or critical, when ...
is the required
frequency response In signal processing and electronics, the frequency response of a system is the quantitative measure of the magnitude and phase of the output as a function of input frequency. The frequency response is widely used in the design and analysis of s ...
. In particular, the steepness and complexity of the response curve is a deciding factor for the filter order and feasibility. A first-order
recursive Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics ...
filter will only have a single frequency-dependent component. This means that the
slope In mathematics, the slope or gradient of a line is a number that describes both the ''direction'' and the ''steepness'' of the line. Slope is often denoted by the letter ''m''; there is no clear answer to the question why the letter ''m'' is use ...
of the frequency response is limited to 6 dB per
octave In music, an octave ( la, octavus: eighth) or perfect octave (sometimes called the diapason) is the interval between one musical pitch and another with double its frequency. The octave relationship is a natural phenomenon that has been refer ...
. For many purposes, this is not sufficient. To achieve steeper slopes, higher-order filters are required. In relation to the desired frequency function, there may also be an accompanying ''weighting'' function, which describes, for each frequency, how important it is that the resulting frequency function approximates the desired one. The larger weight, the more important is a close approximation. Typical examples of frequency function are: * A
low-pass filter A low-pass filter is a filter that passes signals with a frequency lower than a selected cutoff frequency and attenuates signals with frequencies higher than the cutoff frequency. The exact frequency response of the filter depends on the filt ...
is used to cut unwanted high-frequency signals. * A
high-pass filter A high-pass filter (HPF) is an electronic filter that passes signals with a frequency higher than a certain cutoff frequency and attenuates signals with frequencies lower than the cutoff frequency. The amount of attenuation for each frequency ...
passes high frequencies fairly well; it is helpful as a filter to cut any unwanted low-frequency components. * A
band-pass filter A band-pass filter or bandpass filter (BPF) is a device that passes frequencies within a certain range and rejects (attenuates) frequencies outside that range. Description In electronics and signal processing, a filter is usually a two-port ...
passes a limited range of frequencies. * A
band-stop filter In signal processing, a band-stop filter or band-rejection filter is a filter that passes most frequencies unaltered, but attenuates those in a specific range to very low levels. It is the opposite of a band-pass filter. A notch filter is a ...
passes frequencies above and below a certain range. A very narrow band-stop filter is known as a notch filter. * A
differentiator In electronics, a differentiator is a circuit that is designed such that the output of the circuit is approximately directly proportional to the rate of change (the time derivative) of the input. A true differentiator cannot be physically realized, ...
has an amplitude response proportional to the frequency. * A low-shelf filter passes all frequencies, but increases or reduces frequencies below the shelf frequency by specified amount. * A high-shelf filter passes all frequencies, but increases or reduces frequencies above the shelf frequency by specified amount. * A peak EQ filter makes a peak or a dip in the frequency response, commonly used in parametric equalizers.


Phase and group delay

* An all-pass filter passes through all frequencies unchanged, but changes the phase of the signal. Filters of this type can be used to equalize the group delay of recursive filters. This filter is also used in phaser effects. * A
Hilbert transform In mathematics and in signal processing, the Hilbert transform is a specific linear operator that takes a function, of a real variable and produces another function of a real variable . This linear operator is given by convolution with the functi ...
er is a specific all-pass filter that passes sinusoids with unchanged amplitude but shifts each sinusoid phase by ±90°. * A fractional delay filter is an all-pass that has a specified and constant group or phase delay for all frequencies.


The impulse response

There is a direct correspondence between the filter's frequency function and its impulse response: the former is the
Fourier transform A Fourier transform (FT) is a mathematical transform that decomposes functions into frequency components, which are represented by the output of the transform as a function of frequency. Most commonly functions of time or space are transformed ...
of the latter. That means that any requirement on the frequency function is a requirement on the impulse response, and vice versa. However, in certain applications it may be the filter's impulse response that is explicit and the design process then aims at producing as close an approximation as possible to the requested impulse response given all other requirements. In some cases it may even be relevant to consider a frequency function and impulse response of the filter which are chosen independently from each other. For example, we may want both a specific frequency function of the filter ''and'' that the resulting filter have a small effective width in the signal domain as possible. The latter condition can be realized by considering a very narrow function as the wanted impulse response of the filter even though this function has no relation to the desired frequency function. The goal of the design process is then to realize a filter which tries to meet both these contradicting design goals as much as possible.


Causality

In order to be implementable, any time-dependent filter (operating in real time) must be
causal Causality (also referred to as causation, or cause and effect) is influence by which one event, process, state, or object (''a'' ''cause'') contributes to the production of another event, process, state, or object (an ''effect'') where the ca ...
: the filter response only depends on the current and past inputs. A standard approach is to leave this requirement until the final step. If the resulting filter is not causal, it can be made causal by introducing an appropriate time-shift (or delay). If the filter is a part of a larger system (which it normally is) these types of delays have to be introduced with care since they affect the operation of the entire system. Filters that do not operate in real time (e.g. for image processing) can be non-causal. This e.g. allows the design of zero delay recursive filters, where the group delay of a causal filter is canceled by its Hermitian non-causal filter.


Stability

A stable filter assures that every limited input signal produces a limited filter response. A filter which does not meet this requirement may in some situations prove useless or even harmful. Certain design approaches can guarantee stability, for example by using only feed-forward circuits such as an FIR filter. On the other hand, filters based on feedback circuits have other advantages and may therefore be preferred, even if this class of filters includes unstable filters. In this case, the filters must be carefully designed in order to avoid instability.


Locality

In certain applications we have to deal with signals which contain components which can be described as local phenomena, for example pulses or steps, which have certain time duration. A consequence of applying a filter to a signal is, in intuitive terms, that the duration of the local phenomena is extended by the width of the filter. This implies that it is sometimes important to keep the width of the filter's impulse response function as short as possible. According to the uncertainty relation of the Fourier transform, the product of the width of the filter's impulse response function and the width of its frequency function must exceed a certain constant. This means that any requirement on the filter's locality also implies a bound on its frequency function's width. Consequently, it may not be possible to simultaneously meet requirements on the locality of the filter's impulse response function as well as on its frequency function. This is a typical example of contradicting requirements.


Computational complexity

A general desire in any design is that the number of operations (additions and multiplications) needed to compute the filter response is as low as possible. In certain applications, this desire is a strict requirement, for example due to limited computational resources, limited power resources, or limited time. The last limitation is typical in real-time applications. There are several ways in which a filter can have different computational complexity. For example, the order of a filter is more or less proportional to the number of operations. This means that by choosing a low order filter, the computation time can be reduced. For discrete filters the computational complexity is more or less proportional to the number of filter coefficients. If the filter has many coefficients, for example in the case of multidimensional signals such as tomography data, it may be relevant to reduce the number of coefficients by removing those which are sufficiently close to zero. In multirate filters, the number of coefficients by taking advantage of its bandwidth limits, where the input signal is downsampled (e.g. to its critical frequency), and upsampled after filtering. Another issue related to computational complexity is separability, that is, if and how a filter can be written as a convolution of two or more simpler filters. In particular, this issue is of importance for multidimensional filters, e.g., 2D filter which are used in image processing. In this case, a significant reduction in computational complexity can be obtained if the filter can be separated as the convolution of one 1D filter in the horizontal direction and one 1D filter in the vertical direction. A result of the filter design process may, e.g., be to approximate some desired filter as a separable filter or as a sum of separable filters.


Other considerations

It must also be decided how the filter is going to be implemented: *
Analog filter Analogue filters are a basic building block of signal processing much used in electronics. Amongst their many applications are the separation of an audio signal before application to bass, mid-range, and tweeter loudspeakers; the combining and ...
* Analog sampled filter *
Digital filter In signal processing, a digital filter is a system that performs mathematical operations on a sampled, discrete-time signal to reduce or enhance certain aspects of that signal. This is in contrast to the other major type of electronic filter, t ...
* Mechanical filter


Analog filters

The design of linear analog filters is for the most part covered in the
linear filter Linear filters process time-varying input signals to produce output signals, subject to the constraint of linearity. In most cases these linear filters are also time invariant (or shift invariant) in which case they can be analyzed exactly using ...
section.


Digital filters

Digital filter In signal processing, a digital filter is a system that performs mathematical operations on a sampled, discrete-time signal to reduce or enhance certain aspects of that signal. This is in contrast to the other major type of electronic filter, t ...
s are classified into one of two basic forms, according to how they respond to a unit impulse: *
Finite impulse response In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response (or response to any finite length input) is of ''finite'' duration, because it settles to zero in finite time. This is in contrast to infinite impulse ...
, or FIR, filters express each output sample as a weighted sum of the last ''N'' input samples, where ''N'' is the order of the filter. FIR filters are normally non-recursive, meaning they do not use feedback and as such are inherently stable. A
moving average In statistics, a moving average (rolling average or running average) is a calculation to analyze data points by creating a series of averages of different subsets of the full data set. It is also called a moving mean (MM) or rolling mean and is ...
filter or
CIC filter CIC may refer to: Organizations Canada * Cadet Instructors Cadre, a part of the Canadian Armed Forces * Canadian Infantry Corps, renamed in 1947 to Royal Canadian Infantry Corps * Canadian International Council * Canadian Islamic Congress * Che ...
are examples of FIR filters that are normally recursive (that use feedback). If the FIR coefficients are symmetrical (often the case), then such a filter is
linear phase In signal processing, linear phase is a property of a filter where the phase response of the filter is a linear function of frequency. The result is that all frequency components of the input signal are shifted in time (usually delayed) by the s ...
, so it
delays Delays are an English indie band formed in Southampton, which consisted of brothers Greg and Aaron Gilbert, Colin Fox and Rowly until Greg Gilbert's death in 2021. The band's sound combines guitar and synths and featured Greg Gilbert's distinc ...
signals of all frequencies equally which is important in many applications. It is also straightforward to avoid overflow in an FIR filter. The main disadvantage is that they may require significantly more
processing Processing is a free graphical library and integrated development environment (IDE) built for the electronic arts, new media art, and visual design communities with the purpose of teaching non-programmers the fundamentals of computer programming ...
and
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remember ...
resources than cleverly designed IIR variants. FIR filters are generally easier to design than IIR filters - the Parks-McClellan filter design algorithm (based on the
Remez algorithm The Remez algorithm or Remez exchange algorithm, published by Evgeny Yakovlevich Remez in 1934, is an iterative algorithm used to find simple approximations to functions, specifically, approximations by functions in a Chebyshev space that are th ...
) is one suitable method for designing quite good filters semi-automatically. (See
Methodology In its most common sense, methodology is the study of research methods. However, the term can also refer to the methods themselves or to the philosophical discussion of associated background assumptions. A method is a structured procedure for br ...
.) *
Infinite impulse response Infinite impulse response (IIR) is a property applying to many linear time-invariant systems that are distinguished by having an impulse response h(t) which does not become exactly zero past a certain point, but continues indefinitely. This is in ...
, or IIR, filters are the digital counterpart to analog filters. Such a filter contains internal state, and the output and the next internal state are determined by a linear combination of the previous inputs and outputs (in other words, they use
feedback Feedback occurs when outputs of a system are routed back as inputs as part of a chain of cause-and-effect that forms a circuit or loop. The system can then be said to ''feed back'' into itself. The notion of cause-and-effect has to be handled ...
, which FIR filters normally do not). In theory, the impulse response of such a filter never dies out completely, hence the name IIR, though in practice, this is not true given the finite resolution of computer arithmetic. IIR filters normally require less
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
resources than an FIR filter of similar performance. However, due to the feedback, high order IIR filters may have problems with
instability In numerous fields of study, the component of instability within a system is generally characterized by some of the outputs or internal states growing without bounds. Not all systems that are not stable are unstable; systems can also be mar ...
,
arithmetic overflow Arithmetic () is an elementary part of mathematics that consists of the study of the properties of the traditional operations on numbers—addition, subtraction, multiplication, division, exponentiation, and extraction of roots. In the 19th ce ...
, and
limit cycle In mathematics, in the study of dynamical systems with two-dimensional phase space, a limit cycle is a closed trajectory in phase space having the property that at least one other trajectory spirals into it either as time approaches infinity o ...
s, and require careful design to avoid such pitfalls. Additionally, since the
phase shift In physics and mathematics, the phase of a periodic function F of some real variable t (such as time) is an angle-like quantity representing the fraction of the cycle covered up to t. It is denoted \phi(t) and expressed in such a scale that it ...
is inherently a non-linear function of frequency, the time delay through such a filter is frequency-dependent, which can be a problem in many situations. 2nd order IIR filters are often called ' biquads' and a common implementation of higher order filters is to cascade biquads. A useful reference for computing biquad coefficients is th
RBJ Audio EQ Cookbook


Sample rate

Unless the
sample rate In signal processing, sampling is the reduction of a continuous-time signal to a discrete-time signal. A common example is the conversion of a sound wave to a sequence of "samples". A sample is a value of the signal at a point in time and/or spa ...
is fixed by some outside constraint, selecting a suitable sample rate is an important design decision. A high rate will require more in terms of computational resources, but less in terms of
anti-aliasing filter An anti-aliasing filter (AAF) is a filter used before a signal sampler to restrict the bandwidth of a signal to satisfy the Nyquist–Shannon sampling theorem over the band of interest. Since the theorem states that unambiguous reconstruct ...
s. Interference and beating with other signals in the system may also be an issue.


Anti-aliasing

For any digital filter design, it is crucial to analyze and avoid
aliasing In signal processing and related disciplines, aliasing is an effect that causes different signals to become indistinguishable (or ''aliases'' of one another) when sampled. It also often refers to the distortion or artifact that results when ...
effects. Often, this is done by adding analog anti-aliasing filters at the input and output, thus avoiding any frequency component above the
Nyquist frequency In signal processing, the Nyquist frequency (or folding frequency), named after Harry Nyquist, is a characteristic of a sampler, which converts a continuous function or signal into a discrete sequence. In units of cycles per second ( Hz), it ...
. The complexity (i.e., steepness) of such filters depends on the required
signal-to-noise ratio Signal-to-noise ratio (SNR or S/N) is a measure used in science and engineering that compares the level of a desired signal to the level of background noise. SNR is defined as the ratio of signal power to the noise power, often expressed in de ...
and the ratio between the
sampling rate In signal processing, sampling is the reduction of a continuous-time signal In mathematical dynamics, discrete time and continuous time are two alternative frameworks within which variables that evolve over time are modeled. Discrete time ...
and the highest frequency of the signal.


Theoretical basis

Parts of the design problem relate to the fact that certain requirements are described in the frequency domain while others are expressed in the time domain and that these may conflict. For example, it is not possible to obtain a filter which has both an arbitrary impulse response and arbitrary frequency function. Other effects which refer to relations between the time and frequency domain are * The uncertainty principle between the time and frequency domains * The variance extension theorem * The asymptotic behaviour of one domain versus discontinuities in the other


The uncertainty principle

As stated by the
Gabor limit In quantum mechanics, the uncertainty principle (also known as Heisenberg's uncertainty principle) is any of a variety of mathematical inequalities asserting a fundamental limit to the accuracy with which the values for certain pairs of physic ...
, an uncertainty principle, the product of the width of the frequency function and the width of the impulse response cannot be smaller than a specific constant. This implies that if a specific frequency function is requested, corresponding to a specific frequency width, the minimum width of the filter in the signal domain is set. Vice versa, if the maximum width of the response is given, this determines the smallest possible width in the frequency. This is a typical example of contradictory requirements where the filter design process may try to find a useful compromise.


The variance extension theorem

Let \sigma^_ be the variance of the input signal and let \sigma^_ be the variance of the filter. The variance of the filter response, \sigma^_, is then given by : \sigma^_ = \sigma^_ + \sigma^_ This means that \sigma_ > \sigma_ and implies that the localization of various features such as pulses or steps in the filter response is limited by the filter width in the signal domain. If a precise localization is requested, we need a filter of small width in the signal domain and, via the uncertainty principle, its width in the frequency domain cannot be arbitrary small.


Discontinuities versus asymptotic behaviour

Let ''f(t)'' be a function and let F(\omega) be its Fourier transform. There is a theorem which states that if the first derivative of ''F'' which is discontinuous has order n \geq 0, then ''f'' has an asymptotic decay like t^. A consequence of this theorem is that the frequency function of a filter should be as smooth as possible to allow its impulse response to have a fast decay, and thereby a short width.


Methodology

One common method for designing FIR filters is the Parks-McClellan filter design algorithm, based on the Remez exchange algorithm. Here the user specifies a desired frequency response, a weighting function for errors from this response, and a filter order ''N''. The algorithm then finds the set of ''N'' coefficients that minimize the maximum deviation from the ideal. Intuitively, this finds the filter that is as close as you can get to the desired response given that you can use only ''N'' coefficients. This method is particularly easy in practice and at least one textRabiner, Lawrence R., and Gold, Bernard, 1975: Theory and Application of Digital Signal Processing (Englewood Cliffs, New Jersey: Prentice-Hall, Inc.) includes a program that takes the desired filter and ''N'' and returns the optimum coefficients. One possible drawback to filters designed this way is that they contain many small ripples in the passband(s), since such a filter minimizes the peak error. Another method to finding a discrete FIR filter is ''filter optimization'' described in Knutsson et al., which minimizes the integral of the square of the error, instead of its maximum value. In its basic form this approach requires that an ideal frequency function of the filter F_(\omega) is specified together with a frequency weighting function W(\omega) and set of coordinates x_ in the signal domain where the filter coefficients are located. An error function \varepsilon is defined as :\varepsilon = \, W \cdot (F_ - \mathcal \) \, ^ where f(x) is the discrete filter and \mathcal is the
discrete-time Fourier transform In mathematics, the discrete-time Fourier transform (DTFT) is a form of Fourier analysis that is applicable to a sequence of values. The DTFT is often used to analyze samples of a continuous function. The term ''discrete-time'' refers to the ...
defined on the specified set of coordinates. The norm used here is, formally, the usual norm on L^ spaces. This means that \varepsilon measures the deviation between the requested frequency function of the filter, F_, and the actual frequency function of the realized filter, \mathcal \. However, the deviation is also subject to the weighting function W before the error function is computed. Once the error function is established, the optimal filter is given by the coefficients f(x) which minimize \varepsilon. This can be done by solving the corresponding least squares problem. In practice, the L^ norm has to be approximated by means of a suitable sum over discrete points in the frequency domain. In general, however, these points should be significantly more than the number of coefficients in the signal domain to obtain a useful approximation.


Simultaneous optimization in both domains

The previous method can be extended to include an additional error term related to a desired filter impulse response in the signal domain, with a corresponding weighting function. The ideal impulse response can be chosen independently of the ideal frequency function and is in practice used to limit the effective width and to remove ringing effects of the resulting filter in the signal domain. This is done by choosing a narrow ideal filter impulse response function, e.g., an impulse, and a weighting function which grows fast with the distance from the origin, e.g., the distance squared. The optimal filter can still be calculated by solving a simple least squares problem and the resulting filter is then a "compromise" which has a total optimal fit to the ideal functions in both domains. An important parameter is the relative strength of the two weighting functions which determines in which domain it is more important to have a good fit relative to the ideal function.


See also

*
Digital filter In signal processing, a digital filter is a system that performs mathematical operations on a sampled, discrete-time signal to reduce or enhance certain aspects of that signal. This is in contrast to the other major type of electronic filter, t ...
* Prototype filter * Finite impulse response#Filter design


References

* * * * * * * * * *


External links


An extensive list of filter design articles and software at Circuit SageA list of digital filter design software at dspGuruAnalog Filter Design DemystifiedYehar's digital sound processing tutorial for the braindead!
This paper explains simply (between others topics) filters design theory and give some examples {{Electronic filters Digital signal processing Filter theory Signal processing filter